#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 1e3 + 10, INF = 0x3f3f3f3f;

int n;
string s[N];
vector<pair<int, int>> g[26];
int du[26], st[N], tt;
set<int> S;

void dfs(int x)
{
    while (g[x].size()) {
        auto [y, id] = g[x].back();g[x].pop_back();
        dfs(y);
        st[++tt] = id;
    }
}

bool cmp(pair<int, int> a, pair<int, int> b) { return s[a.second] > s[b.second]; }

struct DSU {
    std::vector<int> f, sz;
    DSU() {}
    DSU(int n) { init(n); }
    void init(int n) {
        n++;
        f.resize(n);
        std::iota(f.begin(), f.end(), 0);
        sz.assign(n, 1);
    }
    int find(int x) {
        while (x != f[x]) {
            x = f[x] = f[f[x]];
        }
        return x;
    }
    int size(int x) {
        return sz[find(x)];
    }
    bool merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        sz[x] += sz[y];
        f[y] = x;
        return true;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

void solve()
{
    cin >> n;
    DSU dsu(26);
    for (int i = 1;i <= n;i++) {
        cin >> s[i];
        int x = s[i].front() - 'a', y = s[i].back() - 'a';
        g[x].push_back({ y,i });
        du[x]++;du[y]--;
        S.insert(x);S.insert(y);
        dsu.merge(x, y);
    }
    if (dsu.size(*S.begin()) != S.size()) { cout << "***\n"; return; }

    int cnt[2] = { 0,0 }, p = 1;
    for (int i = 0;i < 26;i++) {
        sort(g[i].begin(), g[i].end(), cmp);
        if (abs(du[i]) <= 1) {
            if (du[i] == 1) { cnt[0]++;p = i; }
            if (du[i] == -1) cnt[1]++;
        } else { cout << "***\n"; return; }
    }
    if ((cnt[0] != 1 && cnt[1] != 1) && (cnt[0] != 0 && cnt[1] != 0)) { cout << "***\n"; return; }
    if (cnt[0] == 0 && cnt[1] == 0) {
        for (int i = 0;i < 26;i++)
            if (g[i].size() != 0) { dfs(i); break; }
    } else dfs(p);

    for (int i = tt;i > 1;i--)
        cout << s[st[i]] << '.';
    cout << s[st[1]];
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}